#if !defined(__URBCSP_H)
#define __URBCSP_H 1

#include "csp_base.h"

typedef char * Constraint; // single constrain

class CSP : public CSP_base {
 private:
  //random CSP generator
  int makeURBCSP(int, int, int, int, int *);
  
  //artificial CSP generator
  int makeDomino(int, int); // args: (n, d, e, csp)

 protected: 
  Constraint* cn; // the constraints
  Constraint  currentc; // the current constraint for constraint check
  Constraint  curij, curji; // used in makeURCSP 

  // have to implement initCSP
  void setupCSP();
  
  // check whether a given tuple satisfies a constraint
  virtual bool validtuple(int, int, int, int);
  virtual void setCurrentConstraint(int i, int j);
  virtual bool validtuple(int x, int y);

  // whether two variables are in one constraint
  virtual bool related(int, int); 

 public:

  CSP(int, int, int, int, int *); // random instances
  CSP(int, int);  // DOMINO instances
  CSP(const char*); //Table instances
  
  // generation of csp through negative way
  void AddConstraint(int, int); 
  void AddNogood(int, int); 
  // artificial generation of csp through positive way 
  void AddC(int, int);
  void AddGood(int, int);

  void printcd(int, int, int); 
  virtual void printCSP();
#ifdef VAL_COMPUTE
  void printVG();
#endif
  virtual ~CSP();
};

#endif
